﻿// Control10Dlg.cpp: 实现文件
//

#include "pch.h"
#include "ProjectAA.h"
#include "Control10Dlg.h"
#include "afxdialogex.h"


// CControl10Dlg 对话框

IMPLEMENT_DYNAMIC(CControl10Dlg, CDialogEx)

CControl10Dlg::CControl10Dlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG_CONTROL_10, pParent)
{

}

CControl10Dlg::~CControl10Dlg()
{
}

void CControl10Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CControl10Dlg, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON26, &CControl10Dlg::OnBnClickedButton26)
	ON_BN_CLICKED(IDC_BUTTON1, &CControl10Dlg::OnBnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON4, &CControl10Dlg::OnBnClickedButton4)
	ON_BN_CLICKED(IDC_BUTTON10, &CControl10Dlg::OnBnClickedButton10)
	ON_BN_CLICKED(IDC_BUTTON2, &CControl10Dlg::OnBnClickedButton2)
	ON_BN_CLICKED(IDC_BUTTON3, &CControl10Dlg::OnBnClickedButton3)
	ON_BN_CLICKED(IDC_BUTTON5, &CControl10Dlg::OnBnClickedButton5)
	ON_BN_CLICKED(IDC_BUTTON6, &CControl10Dlg::OnBnClickedButton6)
	ON_BN_CLICKED(IDC_BUTTON27, &CControl10Dlg::OnBnClickedButton27)
	ON_BN_CLICKED(IDC_BUTTON28, &CControl10Dlg::OnBnClickedButton28)
	ON_BN_CLICKED(IDC_BUTTON29, &CControl10Dlg::OnBnClickedButton29)
	ON_BN_CLICKED(IDC_BUTTON30, &CControl10Dlg::OnBnClickedButton30)
	ON_BN_CLICKED(IDC_BUTTON31, &CControl10Dlg::OnBnClickedButton31)
END_MESSAGE_MAP()


// CControl10Dlg 消息处理程序


BOOL CControl10Dlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	return TRUE; 
}


void CControl10Dlg::OnCancel()
{

	CDialogEx::OnCancel();
}


void CControl10Dlg::OnBnClickedButton26()
{
	if (gSystemMgr.Y36 == OFF) {
		gSystemMgr.m_cIo.SetOutputIo(36, ON);
	}
	else {
		gSystemMgr.m_cIo.SetOutputIo(36, OFF);
	}
}


void CControl10Dlg::OnBnClickedButton1()
{
	if (gSystemMgr.Y17 == OFF) {
		gSystemMgr.m_cIo.SetOutputIo(17, ON);
	}
	else {
		gSystemMgr.m_cIo.SetOutputIo(17, OFF);
	}
}


void CControl10Dlg::OnBnClickedButton4()
{
	if (gSystemMgr.Y02 == OFF) {
		gSystemMgr.m_cIo.SetOutputIo(2, ON);
	}
	else {
		gSystemMgr.m_cIo.SetOutputIo(2, OFF);
	}
}


void CControl10Dlg::OnBnClickedButton10()
{
	if (gSystemMgr.Y03 == OFF) {
		gSystemMgr.m_cIo.SetOutputIo(3, ON);
	}
	else {
		gSystemMgr.m_cIo.SetOutputIo(3, OFF);
	}
}


void CControl10Dlg::OnBnClickedButton2()
{
	gSystemMgr.m_cIo.SetOutputIo(0, ON);
	gSystemMgr.m_cIo.SetOutputIo(1, OFF);
}


void CControl10Dlg::OnBnClickedButton3()
{
	gSystemMgr.m_cIo.SetOutputIo(1, ON);
	gSystemMgr.m_cIo.SetOutputIo(0, OFF);
}


void CControl10Dlg::OnBnClickedButton5()
{
	gSystemMgr.m_cIo.SetOutputIo(4, ON);
	gSystemMgr.m_cIo.SetOutputIo(5, OFF);
}


void CControl10Dlg::OnBnClickedButton6()
{
	gSystemMgr.m_cIo.SetOutputIo(5, ON);
	gSystemMgr.m_cIo.SetOutputIo(4, OFF);
}


void CControl10Dlg::OnBnClickedButton27()
{
	gSystemMgr.m_cIo.SetOutputIo(6, ON);
	gSystemMgr.m_cIo.SetOutputIo(7, OFF);
}


void CControl10Dlg::OnBnClickedButton28()
{
	gSystemMgr.m_cIo.SetOutputIo(7, ON);
	gSystemMgr.m_cIo.SetOutputIo(6, OFF);
}


void CControl10Dlg::OnBnClickedButton29()
{
	if (gSystemMgr.Y44 == OFF) {
		gSystemMgr.m_cIo.SetOutputIo(44, ON);
		if(gSystemMgr.SpeedMode == 1)
			gSystemMgr.m_cIo.SetOutputIo(46, ON);
		else
			gSystemMgr.m_cIo.SetOutputIo(47, ON);
	}
	else {
		gSystemMgr.m_cIo.SetOutputIo(44, OFF);
		gSystemMgr.m_cIo.SetOutputIo(46, OFF);
		gSystemMgr.m_cIo.SetOutputIo(47, OFF);
	}
}


void CControl10Dlg::OnBnClickedButton30()
{
	if (gSystemMgr.Y37 == OFF) {
		gSystemMgr.m_cIo.SetOutputIo(37, ON);
	}
	else {
		gSystemMgr.m_cIo.SetOutputIo(37, OFF);
	}
}


void CControl10Dlg::OnBnClickedButton31()
{
	if (gSystemMgr.Y35 == OFF) {
		gSystemMgr.m_cIo.SetOutputIo(35, ON);
	}
	else {
		gSystemMgr.m_cIo.SetOutputIo(35, OFF);
	}
}
